home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / viewwrld / viewwrld.lha / viewworld / gr / gr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-21  |  2.7 KB  |  77 lines

  1. /* $Id: gr.h,v 2.3 89/09/20 17:01:28 mbp Exp $
  2.  *
  3.  * gr.h: main header file for GR
  4.  */
  5.  
  6. /************************************************************************
  7.  *        Copyright (C) 1989 by Mark B. Phillips                  *
  8.  *                                     *
  9.  * Permission to use, copy, modify, and distribute this software and    *
  10.  * its documentation for any purpose and without fee is hereby granted, *
  11.  * provided that the above copyright notice appear in all copies and    *
  12.  * that both that copyright notice and this permission notice appear in *
  13.  * supporting documentation, and that the name of Mark B. Phillips or   *
  14.  * the University of Maryland not be used in advertising or publicity   *
  15.  * pertaining to distribution of the software without specific, written *
  16.  * prior permission.  This software is provided "as is" without express *
  17.  * or implied warranty.                                                 *
  18.  ************************************************************************/
  19.  
  20. /* NAMING CONVENTION: identifiers beginning with gr_ are external and
  21.  * intended to be used by application program.  Identifiers beginning
  22.  * with GR_ are external but are intended only for use within GR;
  23.  * application programs should usually not use these.  Application
  24.  * programs should avoid all names which begin with either gr_ or GR_.
  25.  */
  26.  
  27. typedef struct gr_Opt_pair_s {
  28.     char    *string;
  29.     int    (*proc)();
  30.     } gr_Opt_pair;
  31.  
  32. typedef struct gr_Menu_s {
  33.     char     *title;
  34.     int     nopts;
  35.     gr_Opt_pair *list;
  36.     } gr_Menu;
  37.     
  38. typedef unsigned int gr_Button;
  39.  
  40. #define GR_INPUT_TEXT_LENGTH 100
  41. #define GR_MESSAGE_LENGTH 100
  42. #define GR_COORDINATE_MESSAGE_LENGTH 100
  43.  
  44. #define GR_LEFT        0001
  45. #define GR_MIDDLE    0002
  46. #define GR_RIGHT    0004
  47. #define GR_SHIFT_LEFT    0010
  48. #define GR_SHIFT_MIDDLE    0020
  49. #define GR_SHIFT_RIGHT    0040
  50. #define GR_ESC        0100
  51. #define GR_ALL_BUTTONS (GR_LEFT|GR_MIDDLE|GR_RIGHT|\
  52.             GR_SHIFT_LEFT|GR_SHIFT_MIDDLE|GR_SHIFT_RIGHT|\
  53.             GR_ESC)
  54.  
  55. double gr_aspect_ratio();
  56.  
  57. extern double GR_x1, GR_y1, GR_x2, GR_y2, GR_xfactor, GR_yfactor;
  58.  
  59. /* Macros for converting fp coords to integer canvas coords: */
  60. #define GR_CANVAS_X(x) (int)(( ((x)-GR_x1)*GR_xfactor ))
  61. #define GR_CANVAS_Y(y) (int)(( ((y)-GR_y2)*GR_yfactor ))
  62. /*   ... and for the reverse direction: */
  63. #define GR_SAVNAC_X(x) ( ((x)/GR_xfactor) + GR_x1)
  64. #define GR_SAVNAC_Y(y) ( ((y)/GR_yfactor) + GR_y2)
  65.  
  66. #define gr_move(x,y) gr_canvas_move(GR_CANVAS_X(x), GR_CANVAS_Y(y))
  67.  
  68. #define gr_draw(x,y) gr_canvas_draw(GR_CANVAS_X(x), GR_CANVAS_Y(y))
  69.  
  70. #define gr_arc( xc,yc,  x1,y1,  x2,y2 )         \
  71.   gr_canvas_arc(GR_CANVAS_X(xc),GR_CANVAS_Y(yc), \
  72.         GR_CANVAS_X(x1),GR_CANVAS_Y(y1), \
  73.         GR_CANVAS_X(x2),GR_CANVAS_Y(y2) )
  74.  
  75. #define gr_show_cursor(x,y) \
  76.   gr_show_canvas_cursor(GR_CANVAS_X(x), GR_CANVAS_Y(y))
  77.